package com.sumer.io.test;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class BIOServer {

    public static void main(String[] args) throws IOException {
        byte[] data = new byte[1024];
        ServerSocket serverSocket = new ServerSocket(8888);
        while (true){
            System.out.println("等待连接");
            Socket accept = serverSocket.accept();
            System.out.println("连接成功，等待数据");
            int count = accept.getInputStream().read(data);
            System.out.println(new String(data,0,count));
        }
    }
}
